<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->view('header','admin');
?>
<div class="subnav">
  <h1 class="title-2 line-x"><?php echo $this->style_info['name'].' - '.L('detail')?></h1>
</div>
<div class="pad-lr-10">
<div class="table-list">
<form action="?app=template&controller=file&action=updatefilename&style=<?php echo $this->style?>" method="post">
    <table class="table table-striped">
        <thead>
		<tr>
		<th align="left" ><?php echo L("dir")?></th>
		<th align="left" ><?php echo L('desc')?></th>
		<th align="left" ><?php echo L('operation')?></th>
		</tr>
        </thead>
<tbody>
<tr>
<td align="left" colspan="3"><?php echo L("local_dir")?>：<?php echo $local?></td>
</tr>
<?php if ($dir !='' && $dir != '.'):?>
<tr>
<td align="left" colspan="3"><a href="<?php echo '?app=template&controller=file&action=init&style='.$this->style.'&dir='.stripslashes(dirname($dir))?>"><img src="<?php echo IMG_PATH?>folder-closed.gif" /><?php echo L("parent_directory")?></a></td>
</tr>
<?php endif;?>
<?php
if(is_array($list)):
	foreach($list as $v):
	$filename = basename($v);
?>
<tr>
<?php if (is_dir($v)) {
	echo '<td align="left"><img src="'.IMG_PATH.'folder-closed.gif" /> <a href="?app=template&controller=file&action=init&style='.$this->style.'&dir='.(isset($_GET['dir']) && !empty($_GET['dir']) ? stripslashes($_GET['dir']).DIRECTORY_SEPARATOR : '').$filename.'"><b>'.$filename.'</b></a></td><td align="left"><input type="text" name="file_explan['.$encode_local.']['.$filename.']" value="'.(isset($file_explan[$encode_local][$filename]) ? $file_explan[$encode_local][$filename] : "").'"></td><td></td>';
} else {
	if (substr($filename,-4,4) == 'html') {
	echo '<td align="left"><img src="'.IMG_PATH.'file.gif" /> '.$filename.'</td><td align="left"><input type="text" name="file_explan['.$encode_local.']['.$filename.']" value="'.(isset($file_explan[$encode_local][$filename]) ? $file_explan[$encode_local][$filename] : "").'"></td><td> <a href="?app=template&controller=file&action=edit_file&style='.$this->style.'&dir='.urlencode(stripslashes($dir)).'&file='.$filename.'">['.L('edit').']</a> <a href="?app=template&controller=file&action=visualization&style='.$this->style.'&dir='.urlencode(stripslashes($dir)).'&file='.$filename.'" target="_blank">['.L('visualization').']</a> <a href="javascript:history_file(\''.$filename.'\')">['.L('histroy').']</a></td>';
	}
}?>
</tr>
<?php
	endforeach;
endif;
?></tbody>
</table>
<div class="btn"><input type="button" onclick="location.href='?app=template&controller=style&action=init'" class="btn btn-primary btn-sm"name="dosubmit" value="<?php echo L('returns_list_style')?>" /> <input type="button" class="btn btn-primary btn-sm"name="dosubmit" value="<?php echo L('new')?>" onclick="add_file()" /> <input type="submit" class="btn btn-primary btn-sm"name="dosubmit" value="<?php echo L('update')?>" ></div>
</form>
</div>
</div>
<script type="text/javascript">
<!--

function history_file(name) {
	window.top.art.dialog.open('?app=template&controller=template_bak&action=init&style=<?php echo $this->style;?>&dir=<?php echo urlencode(stripslashes($dir))?>&filename='+name,{
		title:'《'+name+'》<?php echo L("histroy")?>',
		id:'history',
		width:'700px',
		height:'521px',
		ok: function(iframeWin, topWin){

		},
		cancel: function(){}
	});
}

function add_file() {
	window.top.art.dialog.open('?app=template&controller=file&action=add_file&style=<?php echo $this->style;?>&dir=<?php echo urlencode(stripslashes($dir))?>',{
		title:'<?php echo L("new")?>',
		id:'add_file',
		width:'500px',
		height:'100px',
		ok: function(iframeWin, topWin){
			var form = iframeWin.document.getElementById('dosubmit');
			form.click();
			return false;
		},
		cancel: function(){}
	});
}
//-->
</script>
</body>
</html>